package com.dragon.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private Integer code;   //响应码, 200 代表成功
    private String message; //响应信息 描述字符串
    private Object data;    //返回的数据

    public static Result success() {
        return new Result(200,"success","");
    }

    public static Result success(String msg) {
        return new Result(200,msg,"");
    }

    public static Result success(Object data) {
        return new Result(200,"success",data);
    }

    public static Result success(String msg, Object data) {
        return new Result(200,msg,data);
    }


    public static Result error(String msg){
        return new Result(0,msg,"");
    }

    public static Result error(String msg,Integer code){
        return new Result(code,msg,"");
    }
}
